﻿Public Class GETPRDFROMDRG
    Dim connect As CONDB = CONDB.NewConnection()

    Public Function getPRDCODE(DRGCODE As String) As Integer
        Dim sql As String
        sql = "SELECT prdcode FROM drugitem WHERE drgcode = '" & DRGCODE & "'"

        Dim dt As DataTable
        dt = connect.GetTable(sql)

        If dt.Rows.Count > 0 Then
            Dim PRDCODE As Integer
            PRDCODE = dt.Rows(0)(0)

            Return PRDCODE
        Else
            Return Nothing
        End If
    End Function

    Public Function getDRGCODE(PRDCODE As String) As String
        Dim sql As String
        sql = "SELECT drgcode FROM drugitem WHERE prdcode = '" & PRDCODE & "'"

        Dim dt As DataTable
        dt = connect.GetTable(sql)

        If dt.Rows.Count > 0 Then
            Dim DRGCODE As String
            DRGCODE = dt.Rows(0)(0)

            Return DRGCODE
        Else
            Return Nothing
        End If
    End Function
End Class
